#include <iostream>
#include <signal.h>
#include <sys/time.h>

using std::cout;
using std::endl;

static int totalCost{};
void handle_sig(int signum)
{
    totalCost += 1;
}

int main(int args, char *argv[])
{
    signal(SIGALRM, handle_sig); 
    struct itimerval itm{};
    itm.it_interval.tv_sec = 1;
    itm.it_value.tv_sec = 1;

    setitimer(ITIMER_REAL, &itm, nullptr);
    int j{};
    for(int i{}; i < 1000000000; i++){
        j++;
    };
    printf("%d\n", totalCost);
    return 0;
}